package com.qh.book.converter;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.BeanUtils;

import com.qh.book.dataobj.OrderMaster;
import com.qh.book.dto.OrderDTO;

/**
 * 
 * @author qihong
 * @date 2017年9月17日 下午4:08:05 
 * @Description: 看名字啊 
 */
public class OrderMaster2OrderDTO {

	public static OrderDTO convert(OrderMaster orderMaster) {
		/*
		OrderDTO orderDTO = new OrderDTO();
		orderDTO.setBuyerAddress(orderMaster.getBuyerAddress());
		orderDTO.setBuyerName(orderMaster.getBuyerName());
		orderDTO.setBuyerPhone(orderMaster.getBuyerPhone());
		orderDTO.setOrderAmount(orderMaster.getOrderAmount());
		orderDTO.setOrderId(orderMaster.getOrderId());
		orderDTO.setOrderStatus(orderMaster.getOrderStatus());
		orderDTO.setCreateTime(orderMaster.getCreateTime());
		orderDTO.setPayTime(orderMaster.getPayTime());
		*/
		OrderDTO orderDTO = new OrderDTO();
		BeanUtils.copyProperties(orderMaster, orderDTO);
		return orderDTO;
	}
	
	
	public static List<OrderDTO> convert(List<OrderMaster> orderMasterList) {
		List<OrderDTO> orderDTOlist = new ArrayList<OrderDTO>();
		for (OrderMaster orderMaster : orderMasterList) {
			orderDTOlist.add(convert(orderMaster));
		}
		return orderDTOlist;
	}
}
